<template>
  <div class="content">
    <div class="btnBar">
      <el-button
        size="mini"
        type="primary"
        icon="el-icon-circle-plus"
        @click="addOrUpdate('')">新增</el-button>
    </div>
    <!-- 表格区域 -->
    <cs-table
      :isSelection="false"
      :table-data="tableData"
      :table-label="tableLabel"
      @handleButton="handleButton"
      :table-option="tableOption">
    </cs-table>
    <!-- 分页区域 -->
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="page.pageNo"
      :page-sizes="[10, 15, 20, 30]"
      :page-size="page.pageSize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="page.total">
    </el-pagination>
    <!-- 新增修改对话框 -->
    <file-dialog ref="fileDialog"/>
  </div>
</template>

<script>
import CsTable from '@/components/cs-table'
import FileDialog from '../dialog/fileAddOrUpdate'
import { getFileData } from '@/api/taskCollection/file'
export default {
  data() {
    return {
      tableData: [],
      tableLabel: [
        { label: '名称', param: 'address', align: 'left', isShow: true, minWidth: '30%' },
        { label: '采集方式', param: 'type', align: 'left', isShow: true, minWidth: '20%' },
        { label: '任务间隔(秒)', param: 'collectorAddress', align: 'center', isShow: true, minWidth: '20%' },
        { label: '状态', param: 'event', align: 'center', isShow: true, minWidth: '20%' }
      ],
      tableOption: {
        label: '操作',
        width: '190',
        options: [
          { label: '编辑', type: 'primary', icon: 'el-icon-edit', methods: 'audit', auth: 'sys:group:update' },
          { label: '删除', type: 'danger', icon: 'el-icon-delete', methods: 'delete', auth: 'sys:group:delete' }
        ]
      },
      page: {
        pageNo: 1,
        pageSize: 10,
        total: 0
      }
    }
  },
  components: {
    CsTable,
    FileDialog
  },
  created() {

  },
  methods: {
    // 获取数据
    initFileData() {
      let data = {
        pageNo: this.page.pageNo,
        pageSize: this.page.pageSize
      }
      getFileData(data).then(res => {

      })
    },
    // 新增/修改
    addOrUpdate(row) {
      this.$refs.fileDialog.init()
    },
    handleButton(methods, row, index) {
    },
    // 分页参数
    handleSizeChange(val) {
    },
    handleCurrentChange(val) {
    }
  }
}
</script>

<style lang="scss" scoped>
.btnBar{
  margin-bottom: 10px;
}
</style>
